<?php

/**
 * Base class for all application presenters.
 *
 * @author     John Doe
 * @package    MyApplication
 */
abstract class BasePresenter extends Nette\Application\UI\Presenter
{
    /** @var Model */
    protected $model;

    public function startup()
    {
	parent::startup();
	$this->model = $this->getService('model');
	$this->template->numUnreadMsgs = $this->model->getMsgs()->where(array('rcpt' => $this->getUser()->getId(), 'read' => '0'))->count();
	$this->template->isPremium = $this->isPremium();
    }
    
    public function isPremium()
    {
	if($this->model->isPremium($this->getUser()->getId())) {
	    return TRUE;
	} else {
	    return FALSE;
	}
    }
}
